home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / PInterfaces / PCCardTuples.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  13.7 KB  |  480 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        PCCardTuples.p
  3.  
  4.      Contains:    List of PCMCIA tuple types and definitions of tuple contents.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT PCCardTuples;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __PCCARDTUPLES__}
  27. {$SETC __PCCARDTUPLES__ := 1}
  28.  
  29. {$I+}
  30. {$SETC PCCardTuplesIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36.  
  37.  
  38. {$PUSH}
  39. {$ALIGN MAC68K}
  40. {$LibExport+}
  41.  
  42.  
  43. CONST
  44.     MAX_TUPLE_SIZE                = 256;
  45.  
  46. {————————————————————————————————————————————————————————————————————————
  47.     Defines for Tuple codes
  48. ————————————————————————————————————————————————————————————————————————}
  49.     CISTPL_NULL                    = $00;
  50.     CISTPL_DEVICE                = $01;
  51.     CISTPL_LONGLINK_CB            = $02;
  52.     CISTPL_INDIRECT                = $03;
  53.     CISTPL_CONFIG_CB            = $04;
  54.     CISTPL_CFTABLE_ENTRY_CB        = $05;
  55.     CISTPL_LONGLINK_MFC            = $06;
  56.     CISTPL_BAR                    = $07;
  57.     CISTPL_CHECKSUM                = $10;
  58.     CISTPL_LONGLINK_A            = $11;
  59.     CISTPL_LONGLINK_C            = $12;
  60.     CISTPL_LINKTARGET            = $13;
  61.     CISTPL_NO_LINK                = $14;
  62.     CISTPL_VERS_1                = $15;
  63.     CISTPL_ALTSTR                = $16;
  64.     CISTPL_DEVICE_A                = $17;
  65.     CISTPL_JEDEC_C                = $18;
  66.     CISTPL_JEDEC_A                = $19;
  67.     CISTPL_CONFIG                = $1A;
  68.     CISTPL_CFTABLE_ENTRY        = $1B;
  69.     CISTPL_DEVICE_OC            = $1C;
  70.     CISTPL_DEVICE_OA            = $1D;
  71.     CISTPL_DEVICE_GEO            = $1E;
  72.     CISTPL_DEVICE_GEO_A            = $1F;
  73.     CISTPL_MANFID                = $20;
  74.     CISTPL_FUNCID                = $21;
  75.     CISTPL_FUNCE                = $22;
  76.     CISTPL_SWIL                    = $23;
  77.     CISTPL_VERS_2                = $40;
  78.     CISTPL_FORMAT                = $41;
  79.     CISTPL_GEOMETRY                = $42;
  80.     CISTPL_BYTEORDER            = $43;
  81.     CISTPL_DATE                    = $44;
  82.     CISTPL_BATTERY                = $45;
  83.     CISTPL_ORG                    = $46;
  84.     CISTPL_VENDOR                = $FE;
  85.     CISTPL_END                    = $FF;
  86.  
  87.  
  88. {————————————————————————————————————————————————————————————————————————
  89.     Tuple Data Block Definitions
  90. ————————————————————————————————————————————————————————————————————————}
  91.  
  92. { ------------    Device Information Tuple (01H, 17H)    -----------                             }
  93.  
  94.  
  95. TYPE
  96.     DeviceIDTuplePtr = ^DeviceIDTuple;
  97.     DeviceIDTuple = RECORD
  98.         TPLDEV_TYPE_WPS_SPEED:    SInt8;                                    {  Device Type Code: 7-4, WPS: 3,  Device Speed: 2-0 }
  99.         deviceData:                PACKED ARRAY [0..252] OF Byte;
  100.     END;
  101.  
  102.  
  103. CONST
  104.     TPLDEV_TYPE_MASK            = $F0;                            {  device type mask for TPLDEV_TYPE_WPS_SPEED }
  105.     TPLDEV_TYPE_EXTENDED        = $E0;                            {  device type value for extended type }
  106.     TPLDEV_WPS_MASK                = $08;                            {  write-protect switch mask for TPLDEV_TYPE_WPS_SPEED }
  107.     TPLDEV_SPEED_MASK            = $07;                            {  device speed mask for TPLDEV_TYPE_WPS_SPEED }
  108.     TPLDEV_DSPEED_NULL            = $00;                            {  speed for null device type }
  109.     TPLDEV_DSPEED_250NS            = $01;                            {  250ns card access time }
  110.     TPLDEV_DSPEED_200NS            = $02;                            {  200ns card access time }
  111.     TPLDEV_DSPEED_150NS            = $03;                            {  150ns card access time }
  112.     TPLDEV_DSPEED_100NS            = $04;                            {  100ns card access time }
  113.     TPLDEV_EXTENDED_SPEED        = $07;                            {  device speed value for extended speed }
  114.     TPLDEV_SPEED_EXPONENT        = $07;                            {  extended byte exponent mask }
  115.     TPLDEV_SPEED_MANTISSA        = $78;                            {  extended byte mantissa mask }
  116.     TPLDEV_SPEED_EXTENDED_MASK    = $80;                            {  bit set if more extended speed data follows }
  117.  
  118.  
  119. {     device ID types }
  120.  
  121.     DTYPE_NULL                    = 0;
  122.     DTYPE_ROM                    = 1;
  123.     DTYPE_OTPROM                = 2;
  124.     DTYPE_EPROM                    = 3;
  125.     DTYPE_EEPROM                = 4;
  126.     DTYPE_FLASH                    = 5;
  127.     DTYPE_SRAM                    = 6;
  128.     DTYPE_DRAM                    = 7;
  129.     DTYPE_FUNCSPEC                = $0D;
  130.     DTYPE_EXTEND                = $0E;
  131.  
  132.  
  133. { ---------------    Checksum Control Tuple (10H)    ---------------                             }
  134.  
  135.  
  136. TYPE
  137.     ChecksumControlTuplePtr = ^ChecksumControlTuple;
  138.     ChecksumControlTuple = RECORD
  139.         TPLCKS_ADDR:            INTEGER;                                {  offset to region to be checksummed, LSB first }
  140.         TPLCKS_LEN:                INTEGER;                                {  length of region to be checksummed, LSB first }
  141.         TPLCKS_CS:                SInt8;                                    {  checksum of the region }
  142.         reserved:                SInt8;                                    {  padding }
  143.     END;
  144.  
  145. { ----------------    Long Link Multi-Function Tuple (06H)    ------                     }
  146.  
  147.     LongLinkMFCTuplePtr = ^LongLinkMFCTuple;
  148.     LongLinkMFCTuple = PACKED RECORD
  149.         TPLMFC_NUM:                UInt8;                                    {  Number of sets of config registers for individual functions }
  150.         TPLMFC_TAS1:            UInt8;                                    {  CIS target address space for first function (00 = Attr, 01 = Common) }
  151.         TPLMFC_ADDR1:            UInt32;                                    {  Target address of first CIS, unsigned long, lsb first }
  152.         TPLMFC_TAS2:            UInt8;                                    {  CIS target address space for second function (00 = Attr, 01 = Common) }
  153.         TPLMFC_ADDR2:            PACKED ARRAY [0..3] OF UInt8;            {  [MISALIGNED!] Target address of second CIS, unsigned long, lsb first }
  154.                                                                         {  the following fields are of undetermined length and should be calculated at runtime }
  155.                                                                         {   }
  156.                                                                         {  UInt8        TPLMFC_TASn; }
  157.                                                                         {  UInt32        TPLMFC_ADDRn; }
  158.     END;
  159.  
  160. { ----------------    Long Link Tuple (11H, 12H)    ----------------                             }
  161.  
  162.     LongLinkTuplePtr = ^LongLinkTuple;
  163.     LongLinkTuple = RECORD
  164.         TPLL_ADDR:                UInt32;                                    {  target address, LSB first }
  165.     END;
  166.  
  167. { -----------------    Link Target Tuple (13H)    ------------------                             }
  168.  
  169.     LinkTargetTuplePtr = ^LinkTargetTuple;
  170.     LinkTargetTuple = RECORD
  171.         TPLL_TAG:                PACKED ARRAY [0..2] OF Byte;            {  tag: should be 'C', 'I', 'S' }
  172.     END;
  173.  
  174. { ----------------    Level 1 Version Tuple (15H)    ---------------                             }
  175.  
  176.     Level1VersionTuplePtr = ^Level1VersionTuple;
  177.     Level1VersionTuple = RECORD
  178.         TPLLV1_MAJOR:            SInt8;                                    {  major version number (0x04) }
  179.         TPLLV1_MINOR:            SInt8;                                    {  minor version number (0x01 for release 2.0 and 2.01) }
  180.         TPLLV1_INFO:            SInt8;                                    {  product information string, zero-terminated }
  181.     END;
  182.  
  183. { -------------    JEDEC Identifier Tuple (18H, 19H)    ------------                             }
  184.  
  185.     JEDECDeviceInfoPtr = ^JEDECDeviceInfo;
  186.     JEDECDeviceInfo = RECORD
  187.         manufacturerID:            SInt8;
  188.         manufacturerInfo:        SInt8;
  189.     END;
  190.  
  191.     JEDECIdentifierTuplePtr = ^JEDECIdentifierTuple;
  192.     JEDECIdentifierTuple = RECORD
  193.         device:                    ARRAY [0..0] OF JEDECDeviceInfo;
  194.     END;
  195.  
  196. { ---------    Configuration Tuple (1AH)    ----------                             }
  197.  
  198.     ConfigTuplePtr = ^ConfigTuple;
  199.     ConfigTuple = RECORD
  200.         TPCC_SZ:                SInt8;                                    {  size of fields byte }
  201.         TPCC_LAST:                SInt8;                                    {  index number of last config entry }
  202.         TPCC_RADR:                SInt8;                                    {  config reg's base addr in reg. space }
  203.         reserved:                SInt8;                                    {  padding }
  204.                                                                         {  the following fields are of undetermined length and should be calculated at runtime }
  205.                                                                         { UInt32            TPCC_RMSK; }
  206.                                                                         { UInt32            TPCC_RSVD; }
  207.                                                                         { UInt32            TPCC_SBTPL; }
  208.     END;
  209.  
  210. {     TPCC_RADR field definitions }
  211.  
  212. CONST
  213.     TPCC_RASZ                    = $03;                            {  bits 1-0 }
  214.     TPCC_RMSZ                    = $3C;                            {  bits 5-2 }
  215.     TPCC_RFSZ                    = $C0;                            {  bits 7-6 }
  216.  
  217.  
  218. { ---------    Device Geometry Tuple (1EH, 1FH)    ---------- }
  219.  
  220.  
  221. TYPE
  222.     DeviceGeometryPtr = ^DeviceGeometry;
  223.     DeviceGeometry = RECORD
  224.         DGTPL_BUS:                SInt8;                                    {  system bus width = 2^(n-1), n>0 }
  225.         DGTPL_EBS:                SInt8;                                    {  erase block size = 2^(n-1), n>0 }
  226.         DGTPL_RBS:                SInt8;                                    {  read block size = 2^(n-1), n>0 }
  227.         DGTPL_WBS:                SInt8;                                    {  write block size = 2^(n-1), n>0 }
  228.         DGTPL_PART:                SInt8;                                    {  partitioning size = 2^(n-1), n>0 }
  229.         DGTPL_HWIL:                SInt8;                                    {  hardware interleave = 2^(n-1), n>0 }
  230.     END;
  231.  
  232.     DeviceGeometryTuplePtr = ^DeviceGeometryTuple;
  233.     DeviceGeometryTuple = RECORD
  234.         device:                    ARRAY [0..41] OF DeviceGeometry;
  235.     END;
  236.  
  237. { ---------    Manufacturer Identification Tuple (20H)    ----------                             }
  238.  
  239.     ManufIDTuplePtr = ^ManufIDTuple;
  240.     ManufIDTuple = RECORD
  241.         TPLMID_MANF:            INTEGER;                                {  PCMCIA PC Card manufacturer code }
  242.         TPLMID_CARD:            INTEGER;                                {  manufacturer information (part number and/or revision) }
  243.     END;
  244.  
  245. { -----------    Function Identification Tuple (21H)    ------------                             }
  246.  
  247.     FunctionIDTuplePtr = ^FunctionIDTuple;
  248.     FunctionIDTuple = RECORD
  249.         TPLFID_FUNCTION:        SInt8;                                    {  PC card function code }
  250.         TPLFID_SYSINIT:            SInt8;                                    {  system initialization bit mask }
  251.     END;
  252.  
  253. {     function codes }
  254.  
  255. CONST
  256.     TPLFID_MultiFunction        = 0;
  257.     TPLFID_Memory                = 1;
  258.     TPLFID_SerialPort            = 2;
  259.     TPLFID_ParallelPort            = 3;
  260.     TPLFID_FixedDisk            = 4;
  261.     TPLFID_VideoAdapter            = 5;
  262.     TPLFID_NetworkLANAdapter    = 6;
  263.     TPLFID_AIMS                    = 7;
  264.     TPLFID_SCSI                    = 8;
  265.     TPLFID_Security                = 9;
  266.  
  267.  
  268. { ------------    Software Interleave Tuple (23H)    ---------------                             }
  269.  
  270.  
  271. TYPE
  272.     SoftwareInterleaveTuplePtr = ^SoftwareInterleaveTuple;
  273.     SoftwareInterleaveTuple = RECORD
  274.         TPLSWIL_INTRLV:            SInt8;                                    {  software interleave }
  275.     END;
  276.  
  277. { -------    Level 2 Version and Information Tuple (40H)    --------                             }
  278.  
  279.     Level2VersionTuplePtr = ^Level2VersionTuple;
  280.     Level2VersionTuple = RECORD
  281.         TPLLV2_VERS:            SInt8;                                    {  structure version (0x00) }
  282.         TPLLV2_COMPLY:            SInt8;                                    {  level of compliance with the standard (0x00) }
  283.         TPLLV2_DINDEX:            UInt16;                                    {  byte address of first data byte in card, LSB first }
  284.         TPLLV2_RSV6:            SInt8;                                    {  reserved, must be zero }
  285.         TPLLV2_RSV7:            SInt8;                                    {  reserved, must be zero }
  286.         TPLLV2_VSPEC8:            SInt8;                                    {  vendor specific byte }
  287.         TPLLV2_VSPEC9:            SInt8;                                    {  vendor specific byte }
  288.         TPLLV2_NHDR:            SInt8;                                    {  number of copies of CIS present on this device }
  289.         TPLLV2_OEM:                SInt8;                                    {  vendor of software that formatted card, zero-terminated }
  290.         TPLLV2_INFO:            SInt8;                                    {  informational message about the card, zero-terminated }
  291.         reserved:                SInt8;                                    {  padding }
  292.     END;
  293.  
  294. { --------------------    Format Tuple (41H)    --------------------                             }
  295.  
  296. {  additional information for disk type: }
  297.  
  298.     FormatDiskTuplePtr = ^FormatDiskTuple;
  299.     FormatDiskTuple = RECORD
  300.         TPLFMT_BKSZ:            UInt16;                                    {     block size, or zero if unblocked format }
  301.         TPLFMT_NBLOCKS:            UInt32;                                    {     number of data blocks in this partition }
  302.         TPLFMT_EDCLOC:            UInt32;                                    {     location of error detection code, or zero if interleaved }
  303.     END;
  304.  
  305. {  additional information for disk type: }
  306.     FormatMemTuplePtr = ^FormatMemTuple;
  307.     FormatMemTuple = RECORD
  308.         TPLFMT_FLAGS:            SInt8;                                    {     various flags }
  309.         TPLFMT_RESERVED:        SInt8;                                    {     reserved, set to zero }
  310.         TPLFMT_ADDRESS:            UInt32;                                    {     physical location at which this memory partion must be mapped }
  311.         TPLFMT_EDCLOC:            UInt32;                                    {     location of error detection code, or zero if interleaved }
  312.     END;
  313.  
  314.     FormatTuplePtr = ^FormatTuple;
  315.     FormatTuple = RECORD
  316.         TPLFMT_TYPE:            SInt8;                                    {  format type code }
  317.         TPLFMT_EDC:                SInt8;                                    {  error detection method and length of error detection code }
  318.         TPLFMT_OFFSET:            LONGINT;                                {  offset to first data byte in this partition }
  319.         TPLFMT_NBYTES:            LONGINT;                                {  number of data bytes in this partition }
  320.         CASE INTEGER OF
  321.         0: (
  322.             TPLFMT_DISK:        FormatDiskTuple;
  323.             );
  324.         1: (
  325.             TPLFMT_MEM:            FormatMemTuple;
  326.             );
  327.     END;
  328.  
  329. {     format types }
  330.  
  331. CONST
  332.     TPLFMTTYPE_DISK                = 0;
  333.     TPLFMTTYPE_MEM                = 1;
  334.     TPLFMTTYPE_VS                = $80;
  335.  
  336. {     error detection types }
  337.  
  338.     TPLFMTEDC_NONE                = 0;
  339.     TPLFMTEDC_CKSUM                = 1;
  340.     TPLFMTEDC_CRC                = 2;
  341.     TPLFMTEDC_PCC                = 3;
  342.     TPLFMTEDC_VS                = 8;
  343.  
  344. {     bits in TPLFMT_FLAGS }
  345.  
  346.     TPLFMTFLAGS_ADDR            = 0;
  347.     TPLFMTFLAGS_AUTO            = 1;
  348.  
  349.  
  350. { ------------------    Geometry Tuple (42H)    --------------------                             }
  351.  
  352.  
  353. TYPE
  354.     GeometryTuplePtr = ^GeometryTuple;
  355.     GeometryTuple = RECORD
  356.         TPLGEO_SPT:                SInt8;                                    {  number of sectors per track }
  357.         TPLGEO_TPC:                SInt8;                                    {  number of tracks per cylinder }
  358.         TPLGEO_NCYL:            INTEGER;                                {  number of cylinders, total }
  359.     END;
  360.  
  361. { -----------------    Byte-Order Tuple (43H)    -------------------                             }
  362.  
  363.     ByteOrderTuplePtr = ^ByteOrderTuple;
  364.     ByteOrderTuple = RECORD
  365.         TPLBYTE_ORDER:            SInt8;                                    {  byte order code }
  366.         TPLBYTE_MAP:            SInt8;                                    {  byte mapping code }
  367.     END;
  368.  
  369. {     byte order codes }
  370.  
  371. CONST
  372.     TYPBYTEORD_LOW                = 0;
  373.     TYPBYTEORD_HIGH                = 1;
  374.     TYPBYTEORD_VS                = $80;
  375.  
  376. {     byte mapping codes }
  377.  
  378.     TYPBYTEMAP_LOW                = 0;
  379.     TYPBYTEMAP_HIGH                = 1;
  380.     TYPBYTEMAP_VS                = $80;
  381.  
  382.  
  383. { ----------    Card Initialization Date Tuple (44H)    ------------                             }
  384.  
  385.  
  386. TYPE
  387.     CardInitDateTuplePtr = ^CardInitDateTuple;
  388.     CardInitDateTuple = RECORD
  389.         TPLDATE_TIME:            UInt16;                                    {  hours, minutes, seconds }
  390.         TPLDATE_DAY:            UInt16;                                    {  year, month, day }
  391.     END;
  392.  
  393. { ----------    Battery-Replacement Date Tuple (45H)    ------------                             }
  394.  
  395.     BatteryReplaceDateTuplePtr = ^BatteryReplaceDateTuple;
  396.     BatteryReplaceDateTuple = RECORD
  397.         TPLBATT_RDAY:            UInt16;                                    {  last replacement date (year, month, day) }
  398.         TPLBATT_XDAY:            UInt16;                                    {  battery expiration date (year, month, day) }
  399.     END;
  400.  
  401.  
  402. { ----------------------    General Tuple    -----------------------                             }
  403.  
  404.     TupleBodyPtr = ^TupleBody;
  405.     TupleBody = RECORD
  406.         CASE INTEGER OF
  407.         0: (
  408.             deviceID:            DeviceIDTuple;
  409.             );
  410.         1: (
  411.             checksum:            ChecksumControlTuple;
  412.             );
  413.         2: (
  414.             link:                LongLinkTuple;
  415.             );
  416.         3: (
  417.             target:                LinkTargetTuple;
  418.             );
  419.         4: (
  420.             level1:                Level1VersionTuple;
  421.             );
  422.         5: (
  423.             jedecID:            JEDECIdentifierTuple;
  424.             );
  425.         6: (
  426.             config:                ConfigTuple;
  427.             );
  428.         7: (
  429.             devGeo:                DeviceGeometryTuple;
  430.             );
  431.         8: (
  432.             manufID:            ManufIDTuple;
  433.             );
  434.         9: (
  435.             funcID:                FunctionIDTuple;
  436.             );
  437.         10: (
  438.             swil:                SoftwareInterleaveTuple;
  439.             );
  440.         11: (
  441.             level2:                Level2VersionTuple;
  442.             );
  443.         12: (
  444.             format:                FormatTuple;
  445.             );
  446.         13: (
  447.             geometry:            GeometryTuple;
  448.             );
  449.         14: (
  450.             order:                ByteOrderTuple;
  451.             );
  452.         15: (
  453.             initDate:            CardInitDateTuple;
  454.             );
  455.         16: (
  456.             battDate:            BatteryReplaceDateTuple;
  457.             );
  458.         17: (
  459.             tupleData:            PACKED ARRAY [0..253] OF Byte;
  460.             );
  461.     END;
  462.  
  463.     TuplePtr = ^Tuple;
  464.     Tuple = RECORD
  465.         TPL_CODE:                SInt8;
  466.         TPL_LINK:                SInt8;
  467.         TPL_BODY:                TupleBody;
  468.     END;
  469.  
  470. {$ALIGN RESET}
  471. {$POP}
  472.  
  473. {$SETC UsingIncludes := PCCardTuplesIncludes}
  474.  
  475. {$ENDC} {__PCCARDTUPLES__}
  476.  
  477. {$IFC NOT UsingIncludes}
  478.  END.
  479. {$ENDC}
  480.